package com.ruoyi.project.system.memberspreadbackground.service.impl;

import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.system.memberspreadbackground.domain.MemberSpreadBackground;
import com.ruoyi.project.system.memberspreadbackground.mapper.MemberSpreadBackgroundMapper;
import com.ruoyi.project.system.memberspreadbackground.service.IMemberSpreadBackgroundService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * 我要推广背景图Service业务层处理
 * 
 * @author LCL
 * @date 2021-10-26
 */
@Service
public class MemberSpreadBackgroundServiceImpl implements IMemberSpreadBackgroundService 
{
    @Autowired
    private MemberSpreadBackgroundMapper memberSpreadBackgroundMapper;

    /**
     * 查询我要推广背景图
     * 
     * @param id 我要推广背景图ID
     * @return 我要推广背景图
     */
    @Override
    public MemberSpreadBackground selectMemberSpreadBackgroundById(String id)
    {
        return memberSpreadBackgroundMapper.selectMemberSpreadBackgroundById(id);
    }

    /**
     * 查询我要推广背景图列表
     * 
     * @param memberSpreadBackground 我要推广背景图
     * @return 我要推广背景图
     */
    @Override
    public List<MemberSpreadBackground> selectMemberSpreadBackgroundList(MemberSpreadBackground memberSpreadBackground)
    {
        return memberSpreadBackgroundMapper.selectMemberSpreadBackgroundList(memberSpreadBackground);
    }

    /**
     * 新增我要推广背景图
     * 
     * @param memberSpreadBackground 我要推广背景图
     * @return 结果
     */
    @Override
    public int insertMemberSpreadBackground(MemberSpreadBackground memberSpreadBackground)
    {
        memberSpreadBackground.setId(UUID.randomUUID().toString().replace("-",""));
        memberSpreadBackground.setCreatedTime(new Date());
        return memberSpreadBackgroundMapper.insertMemberSpreadBackground(memberSpreadBackground);
    }

    /**
     * 修改我要推广背景图
     * 
     * @param memberSpreadBackground 我要推广背景图
     * @return 结果
     */
    @Override
    public int updateMemberSpreadBackground(MemberSpreadBackground memberSpreadBackground)
    {
        memberSpreadBackground.setUpdatedTime(new Date());
        return memberSpreadBackgroundMapper.updateMemberSpreadBackground(memberSpreadBackground);
    }

    /**
     * 删除我要推广背景图对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMemberSpreadBackgroundByIds(String ids)
    {
        return memberSpreadBackgroundMapper.deleteMemberSpreadBackgroundByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除我要推广背景图信息
     * 
     * @param id 我要推广背景图ID
     * @return 结果
     */
    @Override
    public int deleteMemberSpreadBackgroundById(String id)
    {
        return memberSpreadBackgroundMapper.deleteMemberSpreadBackgroundById(id);
    }

    @Override
    public List<MemberSpreadBackground> findSpreadBackgroundListByMemberId(String memberId) {
        return memberSpreadBackgroundMapper.findSpreadBackgroundListByMemberId(memberId);
    }

    @Override
    public int deleteMemberSpreadBackgroundByMemberId(String memberId) {
        return memberSpreadBackgroundMapper.deleteMemberSpreadBackgroundByMemberId(memberId);
    }

}
